import config from '@/config';
import RequestBase from '@/utils/request.js';

const baseRequest = new RequestBase(config.equipment);

//查询巡检任务
export function getTask(status, data) {
  return baseRequest.get(
    `/mobile/dfm/inspection/sub-task/getList/${status}`,
    data
  );
}

//查询巡检表单
export function getTableList(data) {
  return baseRequest.get('/mobile/dfm/inspection/getMyInspectionList', data);
}

//查询巡检任务详情
export function queryTaskDetail(subTaskId) {
  return baseRequest.get(`/mobile/dfm/inspection/sub-task/detail/${subTaskId}`);
}

//查询子任务部位标准列表
export function queryPositionDetail(data) {
  return baseRequest.get(
    '/mobile/dfm/inspection/sub-task/position/standard/list',
    data
  );
}

//保存巡检部位
export function savePositionDetail(data) {
  return baseRequest.put(
    '/mobile/dfm/inspection/sub-task/position/standard/handle',
    data
  );
}

//巡检完毕
export function savePositionHandle(data) {
  return baseRequest.put(
    '/mobile/dfm/inspection/sub-task/position/handle',
    data
  );
}

//巡检表单关联的所有计划
export function getPlanList(inspectionId) {
  return baseRequest.get(`/mobile/dfm/inspection/getPlanList/${inspectionId}`);
}

//根据计划id获取子任务列表
export function getListByPlanId(planId, data) {
  return baseRequest.get(
    `/mobile/dfm/inspection/sub-task/getListByPlanId/${planId}`,
    data
  );
}

//查询巡检任务标题数量
export function getTitleNum() {
  return baseRequest.get(`/mobile/dfm/inspection/sub-task/title/num`);
}
